package my.interview;

import java.util.Scanner;

/**
 * @DESCRIPTION:
 * @USER: shg
 * @DATE: 2022/12/21 11:58
 */
public class HJ17_ {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int x = 0, y = 0;
        String[] split = s.split(";");
        for (String s1 : split) {
            if (!s1.matches("[WSAD][0-9]{1,2}")) {
                continue;
            }
            int val = Integer.valueOf(s1.substring(1));
            switch (s1.charAt(0)) {
                case 'W':
                    y += val;
                    break;
                case 'S':
                    y -= val;
                    break;
                case 'D':
                    x += val;
                    break;
                case 'A':
                    x -= val;
                    break;
            }
        }
        System.out.println(x+","+y);
    }
}
